<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/WEB-TAG/platForm.tld" prefix="PF"%>
<!--数据查询器表单-->
<div class="easyui-layout" data-options="fit:true">
	<div class="TableTitle" data-options="region:'north',border:false">
		<c:if test="${pageset.pageType==1}">新增${JSP_Messager_Title}记录</c:if>
		<c:if test="${pageset.pageType==2}">修改${JSP_Messager_Title}记录</c:if>
		<c:if test="${pageset.pageType==0}">浏览${JSP_Messager_Title}记录</c:if>
	</div>
	<div data-options="region:'center'">
		<form id="dom_formQuery">
			<input type="hidden" id="entity_id" name="entity.id"
				value="${entity.id}">
			<table class="editTable">
				<tr>
					<td class="title">
						分类:
					</td>
					<td colspan="3">
						<c:if test="${type!=null&&type.id!=null}">
					        ${type.name}
					        <input type="hidden" name='entity.typeid'
								value="${type.id}" />
						</c:if>
						<c:if test="${type==null||type.id==null}">
					        无
					    </c:if>
					</td>
				</tr>
				<tr>
					<td class="title">
						查询名称:
					</td>
					<td>
						<input type="text" style="width: 120px;"
							class="easyui-validatebox"
							data-options="required:true,validType:[,'maxLength[32]']"
							id="entity_name" name="entity.name" value="${entity.name}">
					</td>
					<td class="title">
						是否导出报表:
					</td>
					<td>
						<select name="entity.reportable" id="entity_reportable"
							style="width: 120px;" val="${entity.reportable}">
							<option value="0">
								否
							</option>
							<option value="1">
								是
							</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="title">
						SELECT:
					</td>
					<td colspan="3">
						<textarea rows="2" style="width: 400px;"
							class="easyui-validatebox"
							data-options="required:true,validType:[,'maxLength[1024]']"
							id="entity_selectstr" name="entity.selectstr">${entity.selectstr}</textarea>
					</td>
				</tr>
				<tr>
					<td class="title">
						FROM:
					</td>
					<td colspan="3">
						<textarea rows="2" style="width: 400px;"
							class="easyui-validatebox"
							data-options="required:true,validType:[,'maxLength[1024]']"
							id="entity_fromstr" name="entity.fromstr">${entity.fromstr}</textarea>
					</td>
				</tr>
				<tr>
					<td class="title">
						默认SQL查询条件:
					</td>
					<td colspan="3">
						<textarea rows="2" style="width: 400px;"
							class="easyui-validatebox"
							data-options="required:false,validType:[,'maxLength[256]']"
							id="entity_defaultrule" name="entity.defaultrule">${entity.defaultrule}</textarea>
					</td>
				</tr>
				<tr>
					<td class="title">
						默认排序字段:
					</td>
					<td>
						<input type="text" style="width: 120px;"
							class="easyui-validatebox"
							data-options="validType:[,'maxLength[32]']"
							id="entity_defsortstr" name="entity.defsortstr"
							value="${entity.defsortstr}">
					</td>
					<td class="title">
						默认排序类型:
					</td>
					<td>
						<select name="entity.defsorttype" id="entity_defsorttype"
							style="width: 120px;" val="${entity.defsorttype}">
							<option value="4">
								DESC
							</option>
							<option value="1">
								ASC
							</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="title">
						每页显示记录数:
					</td>
					<td>
						<select name="entity.pagesize" id="entity_pagesize"
							style="width: 120px;" val="${entity.pagesize}">
							<option value="10">
								10
							</option>
							<option value="20">
								20
							</option>
							<option value="50">
								50
							</option>
							<option value="100">
								100
							</option>
						</select>
					</td>
					<td class="title">
						报表最大记录数量:
					</td>
					<td>
						<input type="text" style="width: 120px;"
							class="easyui-validatebox"
							data-options="required:true,validType:['integer','maxLength[16]']"
							id="entity_reportmaxnum" name="entity.reportmaxnum"
							value="${entity.reportmaxnum==null?5000:entity.reportmaxnum}">
					</td>
				</tr>
				<tr>
					<td class="title">
						是否去重:
					</td>
					<td>
						<select name="entity.distinctable" id="entity_distinctable"
							style="width: 120px;" val="${entity.distinctable}">
							<option value="0">
								否
							</option>
							<option value="1">
								是
							</option>
						</select>
					</td>
					<td class="title">
						缓存过期时间(分):
					</td>
					<td>
						<input type="text" style="width: 120px;"
							class="easyui-validatebox"
							data-options="validType:['intOrFloat','maxLength[16]']"
							id="entity_cachetime" name="entity.cachetime"
							value="${entity.cachetime}">
					</td>
				</tr>
				<tr>
					<td class="title">
						宽自动适应:
					</td>
					<td>
						<select name="entity.fitcolumns" id="entity_fitcolumns"
							style="width: 120px;" val="${entity.fitcolumns}">
							<option value="0">
								否
							</option>
							<option value="1">
								是
							</option>
						</select>
					</td>
					<td class="title">
						强制单行显示:
					</td>
					<td>
						<select name="entity.nowrap" id="entity_nowrap"
							style="width: 120px;" val="${entity.nowrap}">
							<option value="0">
								否
							</option>
							<option value="1">
								是
							</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="title">
						备注:
					</td>
					<td colspan="3">
						<textarea rows="2" style="width: 400px;"
							class="easyui-validatebox"
							data-options="validType:[,'maxLength[128]']" id="entity_pcontent"
							name="entity.pcontent">${entity.pcontent}</textarea>
					</td>
				</tr>
			</table>
		</form>
	</div>
	<div data-options="region:'south',border:false">
		<div class="div_button" style="text-align: center; padding: 4px;">
			<c:if test="${pageset.pageType==1}">
				<a id="dom_add_entityQuery" href="javascript:void(0)"
					iconCls="icon-save" class="easyui-linkbutton">增加</a>
			</c:if>
			<c:if test="${pageset.pageType==2}">
				<a id="dom_edit_entityQuery" href="javascript:void(0)"
					iconCls="icon-save" class="easyui-linkbutton">修改</a>
			</c:if>
			<a id="dom_edit_testQuery" href="javascript:void(0)"
				iconCls="icon-control-play" class="easyui-linkbutton">测试</a>
			<a id="dom_show_urlService" href="javascript:void(0)"
				iconCls="icon-tip" class="easyui-linkbutton">显示服务URL</a>
			<a id="dom_cancle_formQuery" href="javascript:void(0)"
				iconCls="icon-cancel" class="easyui-linkbutton"
				style="color: #000000;">取消</a>
		</div>
	</div>
</div>
<script type="text/javascript">
	var submitAddActionQuery = 'admin/FarmFormsQueryaddCommit.do';
	var submitEditActionQuery = 'admin/FarmFormsQueryeditCommit.do';
	var currentPageTypeQuery = '${pageset.pageType}';
	var submitFormQuery;
	$(function() {
		//表单组件对象
		submitFormQuery = $('#dom_formQuery').SubmitForm( {
			pageType : currentPageTypeQuery,
			grid : gridQuery,
			currentWindowId : 'winQuery'
		});
		//关闭窗口
		$('#dom_cancle_formQuery').bind('click', function() {
			$('#winQuery').window('close');
		});
		//提交新增数据
		$('#dom_add_entityQuery').bind('click', function() {
			submitFormQuery.postSubmit(submitAddActionQuery, function(flag) {
				$('#domTabsId').val(flag.entity.id);
				showAllTabs();
				return true;
			});
		});
		//提交修改数据
		$('#dom_edit_entityQuery').bind('click', function() {
			submitFormQuery.postSubmit(submitEditActionQuery);
		});
		$('#dom_show_urlService').bind('click', function() {
			$.messager.alert("URL", 'admin/FarmFormsDoQuery.do ?ids=' + $('#domTabsId').val(),
			'info');
		});
		//测试查询功能
		$('#dom_edit_testQuery')
				.bind(
						'click',
						function() {
							if (!$('#domTabsId').val()) {
								$.messager.alert(MESSAGE_PLAT.PROMPT, "先保存该查询",
										'info');
								return;
							}
							window.parent.openUrlAtIfram(
									'admin/FarmFormsDoQuery.do?ids=' + $(
											'#domTabsId').val(), '动态查询',
									'动态查询', true);
						});
	});
	//-->
</script>